/**
 * 1.对象简写
 * 2.key值构建
 * 3.Object.is()对象比较
 *  ===同值相等，is()严格相等
 * 4.Object.assign()对象合并
 */
console.log('============>1.对象简写<============')
// 传统对象
var title = "ES6语法";
var link = "www.maple-soa.com";
var info = {
    title: title,
    link: link,
    sayHello: function() {
        console.log("Hello，拥抱大前端ES6.")
    }
};
console.log("传统：", info);
// es6
let info1 = {
    title,
    link,
    sayHello() {
        console.log("Hello，拥抱大前端ES6.")
    }
};
console.log("es6：", info1);
info1.sayHello();

console.log('============>2.key值构建<============')
let key = 'username'
let obj = {
    [key]: 'lijian'
}
console.log('key值构建: ', obj);

console.log('============>3.Object.is()对象比较<============')
let obj1 = {'username': 'Maple'}
let obj2 = {'username': 'Maple'}
console.log('Object.is()=>', Object.is(obj1.username, obj2.username))
// ===同值相等，is()严格相等
console.log('===: ', +0 === -0);
console.log('===: ', NaN === NaN);
console.log('Object.is(): ', Object.is(+0, -0));
console.log('Object.is(): ', Object.is(NaN, NaN));

console.log('============>4.Object.assign()对象合并<============')
let name = {'name': 'Maple'}
let age = {'age': 29}
let user = Object.assign(name, age)
console.log('Object.assign(): ', user)